package gac.helloworld;

import java.util.Calendar;

public class AlarmData {
	
    private String mDestination;
    private int mHour;
    private int mMinute;
    private int mWarnTime;
    private long mId;
    private int mMonth, mDay, mYear;
    private int mIsOn;
    private Calendar mEstimatedLeave;
	
	public AlarmData(long id, String destination, int hour, int min, int warnTime, int month, int date, int year, int isOn) {
    	mDestination = destination;
    	mHour = hour;
    	mMinute = min;
    	mWarnTime = warnTime;
    	mId = id;
    	mMonth = month;
    	mDay = date;
    	mYear = year;
    	mIsOn = isOn;
	}
	
	public long getId() {
    	return mId;
    }
    
    public String toString() {
    	return "Alarm for " + mDestination;
    }
    
    public boolean isOn()
    {
    	return mIsOn == 1;
    }
    
    public AlarmData() { }
    
    public String getDestination() {
        return mDestination;
    }
    public void setDestination(String destination) {
        mDestination = destination;
    }
    
    public int getAlarmHour() {
        return mHour;
    }
    public void setAlarmHour(int hour) {
        mHour = hour;
    }	
    
    public int getAlarmMin() {
        return mMinute;
    }
    public void setAlarmMin(int min) {
        mMinute = min;
    }	
    
    public int getWarnTime(){
    	return mWarnTime;
    }
    
    public void setWarnTime(int warnTime){
    	mWarnTime = warnTime;
    }

    public String pad(int padMe)
    {
    	if (padMe < 10)
    		return "0" + padMe; 
    	else
    		return "" + padMe;
    }
    
    public String getAlarmDateString()
    {
    	return (mMonth + 1) + "/" + mDay + "/" + mYear;
    }

	public String getArrivalTimeString() {
		// TODO Auto-generated method stub
		int hour = mHour;
		int minute = mMinute;
		String amPM = "AM";
		
		if(hour == 0)
		{
			hour = 12;
		}
		if (hour > 12) {
			hour = hour - 12;
			amPM = "PM";
		}
		return hour + ":" + pad(minute) + " "+amPM;
	}
	
	/*public String getAlarmTimeString() {
		if (mWarnTime == NO_WARN_TIME)
				return "unspecified";
		else{
			return MapHandlerActivity.timeUntilAlarm(mDestination, mHour*3600+mMinute*60, mWarnTime*60);
		}
	}*/
	
	
	
}
